#include "../game_server.cpp"
#include "../user.cpp"
#include "../room.cpp"
#include "ws_websocket.hpp"
#include <iostream>

using namespace std;
using namespace winux;
FASTDO_API void ActionMain(ProtocolC2SGetTotalMsg *msg, pWsReqCtx ctx, GameServer &game)
{
    auto user = game.getUser(ctx);
    if (!user)
    {
        return;
    }
    auto room = game.getRoomByUser(user);
    if (room)
    {
        ProtocolS2CTotalMsg rtn;
        rtn.time = room->totalDataTime;
        rtn.data = room->totalData;
        ctx->send(ws::OpCode::dataText, false, rtn.toMixed().json());
    }
}